package com.unalm.examensustitutorio.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;

import com.unalm.examensustitutorio.util.entity.EAula;
import com.unalm.examensustitutorio.util.entity.EUsuario;


public class DAula implements IDAula{
	private EntityManagerFactory emf;
	private EntityManager em;
	
	public void setEmf(EntityManagerFactory emf) {
		this.emf = emf;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<EAula> listarAulas() {
		List<EAula> lstAulas = null;
		em = emf.createEntityManager();
		try {
			Query consulta = em
					.createQuery("select a from EAula a where a.int_dispoAula=1");

			lstAulas = consulta.getResultList();

		} catch (Exception e) {

			e.printStackTrace();
		} finally {
			em.close();
		}

		return lstAulas;
	}

	


	
}
